<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:f="http://java.sun.com/jsf/core"
      >
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
        <link href="./resources/css/default.css" rel="stylesheet" type="text/css" />
        <link href="./resources/css/cssLayout.css" rel="stylesheet" type="text/css" />
        <title>TODO supply a title</title>
    </head>
     <ui:composition template="/template.xhtml">
           <ui:define name="left">
               <h:form id="menu">
                   <h:commandLink action="/index" value="Menu"/>
               </h:form>
           </ui:define>
           <ui:define name="content">
               <h:form id="fomulario">
                   <h:panelGrid columns="1" width="400px">
                       <h:dataTable id="personas" 
                           border="1"
                           value="#{personaAction.listaPersonas}" var="persona">
                           <h:column>
                               <f:facet name="header" >
                                  <h:outputText value="Nombre"/>
                              </f:facet>
                              <h:outputText value="#{persona.nombre}"/>
                           </h:column>

                           <h:column>
                               <f:facet name="header" >
                                  <h:outputText value="Email"/>
                              </f:facet>
                              <h:outputText value="#{persona.email}"/>
                           </h:column>

                           <h:column>
                               <f:facet name="header" >
                                  <h:outputText value="Eliminar"/>
                              </f:facet>
                               <h:commandLink action="#{personaAction.cargarEditarPersona}" value="Edit">
                                   <f:param name="idPersona" value="#{persona.id}"></f:param>
                               </h:commandLink>
                           </h:column>
                           <h:column>
                               <f:facet name="header" >
                                  <h:outputText value="Eliminar"/>
                              </f:facet>
                                <h:commandLink action="#{personaAction.eliminarPersona}" value="Elim">
                                   <f:param name="idPersona" value="#{persona.id}"></f:param>
                               </h:commandLink>
                           </h:column>
                       </h:dataTable>
                   </h:panelGrid>
                   <br/>
                   <h:panelGrid columns="1">
                       <h:commandButton value="Adcionar" action="/persona/personaEdit"/>
                   </h:panelGrid>
                </h:form>
           </ui:define>
       </ui:composition>
</html>
